#!/usr/bin/env python
# coding=utf-8
# @FileName  :2.py
# @Time      :2024/7/10 17:47
# @Author    :jdz
# @description :
# Create a coroutine
import asyncio

coro = asyncio.sleep(1, result=3)

# Submit the coroutine to a given loop
future = asyncio.run_coroutine_threadsafe(coro, loop=asyncio.new_event_loop())

# Wait for the result with an optional timeout argument
assert future.result(timeout=4) == 3
